Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rollup-extras/plugin-clean

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup-extras/plugin-clean

Rollup plugin to clean a directory during build.

  • 1.3.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Plugin Clean

Rollup plugin to clean a directory during the build.

Points:

  • Uses fs.rm to remove directories that shipped with nodejs and has built-in retries
  • Can be used with no configuration
  • Runs once per directory by default (good for watch mode)
  • A minimal amount of logs by default

No globs support, please use rollup-plugin-delete for globs.

The plugin runs on renderStart per each output and uses output.dir as a default target.

Uses @niceties/logger to log messages, can be configured through @niceties/logger API.

Changelog

Installation

npm install --save-dev @rollup-extras/plugin-clean

Examples

Normal usage:

import clean from '@rollup-extras/plugin-clean';

export default {
	input: 'src/index.js',

    output: {
        format: 'es',
        dir: 'dest'
    },

	plugins: [clean()],
}

To override/provide target directory to clean use:

clean('dir')

or

clean(['dir1', 'dir2'])

or

clean({targets: 'dir1'})

or

clean({targets: ['dir1', 'dir2']})

Other supported fields in the options object: pluginName, deleteOnce, outputPlugin and verbose.

pluginName is just for debugging purposes so you can understand which instance of the plugin is responsible for an error.

deleteOnce can be set to false if you want to clean the directory for every rebuild.

outputPlugin can be set to false if you want the plugin to trigger earlier (use with caution, you may want to define targets yourself in this mode)

verbose is to get more messages in the console.

Configuration

type CleanPluginOptions = {
    targets?: string | string[], // defaulted to output.dir per output
    pluginName?: string, // for debugging purposes, default is `@rollup-extras/plugin-clean`
    deleteOnce?: boolean, // default true
    outputPlugin?: boolean, // default true
    verbose?: boolean // default false
} | string | string[];

Prior Art

License

MIT

Keywords

FAQs

Package last updated on 11 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc